<h1 class="page-header">
    <small>短信模板</small>
</h1>
<hr/>
<div class="panel panel-inverse" data-sortable-id="form-stuff-1">
    <div class="panel-heading">
        <h4 class="panel-title">新增短信模板</h4>
    </div>
    <div class="panel-body">
        <form id="activityForm" name="activityForm" method="post" class="form-horizontal">
            <div class="form-group">
                <label class="col-md-3 control-label">*名称：</label>
                <div class="col-md-6">
                    <input type="text" class="form-control" name="name" placeholder="名称 6-50位" rangelength="6,50" required/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label">*英文名称：</label>
                <div class="col-md-6">
                    <input type="text" class="form-control" name="uname" placeholder="名称 6-50位" rangelength="6,50" required/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label">*编码：</label>
                <div class="col-md-6">
                    <input type="text" class="form-control" name="code" placeholder="编码 6-100位" rangelength="6,100" required/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label">*内容：</label>
                <div class="col-md-6">
                    <textarea rows="5" class="form-control" id="content" name="content"
                              maxlength="500" placeholder="请输入短信内容"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label"></label>
                <div class="col-md-6">
                    <button type="button" id="submitButton" class="btn btn-sm btn-success">提交
                    </button>
                    <button type="button" class="btn btn-sm btn-danger"
                            onclick="getData('${rc.contextPath}/backend/smsTemplate/index','displayArea')">返回
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="application/javascript">
    $(function () {
        $('#submitButton').click(function () {
            $('#activityForm').submit();
        })

        $('#activityForm').validate({
            rules: {},
            messages: {},
            errorPlacement: function (error, element) {
                error.appendTo(element.parent());
            },
            submitHandler: function () {
                layer.confirm('确认新增短信模板？', {
                    btn: ['确定']
                }, function () {
                    postDataByForm('${rc.contextPath}/backend/smsTemplate/save', 'displayArea', 'activityForm');
                    $.close();
                }, function () {
                    $.close();
                });
            }
        })
    });

</script>